package com.xc.btc.util;

import java.net.HttpURLConnection;
import java.util.function.Supplier;

/**
 * 绕开在同一对象aop注解不生效工具类
 */
public class AopUtil {
    public static Object excute(Supplier supplier){
        return supplier.get();
        }

    public static void excute(Runnable runnable){
        runnable.run();
    }

    public static void main(String[] args) {
        String s = "https://www.baidu.com/";
        String result = (String) AopUtil.excute(()->{return HttpClient.doGet(s);});
        System.out.println(result);
        AopUtil.excute(()->{HttpClient.doGet(s);});
    }
}
